    <include file="Footprint:header"/>
	<include file="Footprint:share_header"/>
</head>

<body>
<div class="wraper">
    <div class="prize-top">
    	<input type="hidden" value="{BEESCRM:$data.prize_id}" id="prize_id" />
        <img class="prize-img" src="{BEESCRM:$data.picture}"/>
        <p class="price">价值￥{BEESCRM:$data.price}</p>
        <p>{BEESCRM:$data.name}</p>
        <p>{BEESCRM:$data.description}</p>
    </div>
    <div class="inputbox">
    	<input type="hidden" value="{BEESCRM:$wechat_id}" id="wechat_id" />
    	<input type="hidden" value="{BEESCRM:$act_id}" id="act_id" />
    	<input type="hidden" value="{BEESCRM:$line_id}" id="line_id" />
    	<input type="hidden" value="{BEESCRM:$color_id}" id="color_id">
        <p class="write-mes">请填写您的收货地址</p>
        <input class="input" type="text" id="username" placeholder="姓名"/>
        <input class="input" type="tel" id="mobile" placeholder="电话"/>
        <input class="input" type="text" id="address"  placeholder="地址"/>
    </div>
    <p class="prompt">寄送期间请保持通话正常哦~</p>
    <a class="green-btn" id="okgo">确认提交</a>

    <div class="pop-box" id="success">
        <span class="iconfont icon-duigou duigou" style="font-size: 60px"></span>
        <div class="main">
            <p class="warming">信息提交成功</p>
            <p>我们会尽快寄出礼品，请耐心等待</p>
            <div>
                <a href="{BEESCRM::U('/Activity/Footprint/lineDetail',array('wechat_id' => $wechat_id,'act_id' => $act_id,'line_id'=>$line_id,'color_id'=>$color_id))}" class="share-btn">返回体验线路</a>
                <a href="{BEESCRM::U('/Activity/Footprint/ucenter',array('wechat_id' => $wechat_id,'act_id' => $act_id,'route'=>1))}" class="share-btn">前往个人中心</a>
            </div>
        </div>
    </div>
</div>

<script>
    $(function(){
        $('#ok').click(function(){
            $('#success').show();
        })
    });
//查看答案
    $(document).on('click','#okgo',function(){
    	var prize_id = $('#prize_id').val();
    	var color_id = $('#color_id').val();
    	var line_id = $('#line_id').val();
    	var username = $('#username').val();
    	var mobile = $('#mobile').val();
    	var address = $('#address').val();
    	var act_id = $('#act_id').val();
    	var wechat_id = $('#wechat_id').val();
    	username = username.replace(/^\s+|\s+$/g,"");
    	if(username == ''){
    		infotips('姓名不能为空',$('.submit_tips'));
    		return false;
    	}
    	if(mobile == ''){
    		infotips('电话不能为空',$('.submit_tips'));
    		return false;
    	}
    	var reg = /^0?(13[0-9]|15[012356789]|17[678]|18[0-9]|14[57])[0-9]{8}$/;
		if (!reg.test(mobile)) {
			infotips('请输入正确的电话号码',$('.submit_tips'));
			return false;
		}
		address = address.replace(/^\s+|\s+$/g,"");
    	if(address == ''){
    		infotips('地址不能为空',$('.submit_tips'));
    		return false;
    	}
    	var url = "/Activity/Footprint/prize/wechat_id/"+wechat_id+"/act_id/"+act_id;
        var data = {'color_id':color_id, 'line_id':line_id, 'prize_id':prize_id,'username':username,'mobile':mobile,'address':address};
        $.ajax({
  	         type:'post',
  	         dataType:'json',
  	       	 data:data,
  	         url:url,
  	         success:function(data){
  	        	 if(data.status == 'S'){
  	        		 console.log(data);
  	        		//infotips(data.message,$('.submit_tips'),'right');
  	        		$('#success').show();
  				}else{
  					infotips(data.message,$('.submit_tips')); 
  				}
  	         },
  	         error:function(){
  	        	 infotips('请稍后再试',$('.submit_tips'));
  	         },
  	       });
    })
</script>
</body>

</html>
